#include <avr/pgmspace.h>
#include "env_dev.h"
#include "io_modul.h"
#include "clock.h"
#include "can.h"
#include "cross.h"

/*place all cross functions here !!!

can to io
timer to io
timer to can
etc


*/
//temp

void can_to_clock(uint8_t * data) {

struct_time time;

if (data[0] == TYPE_SET_TIME)
{
time.sec=data[1];
time.min=data[2];
time.hour=data[3];
time.day=data[4];
time.month=data[5];
time.year=data[6];

set_clock(&time);
}

return;
}


void can_to_io(uint8_t * data) {

if (data[0] == TYPE_ROLLO) 
{
	set_io_rollo(data[1],data[2]);
}

else if (data[0] == TYPE_ROLLO_MULTI) 
{
	uint8_t i=1;
	while (data[i] && (i<7)) 
	{
		uint8_t port=data[i];
		uint8_t value=data[7];
		set_io_rollo(port,value);
		i++;
	}
}


return;
}
